home *** CD-ROM | disk | FTP | other *** search
- head 1.8;
- branch ;
- access ;
- symbols beta10:1.7;
- locks death:1.8;
- comment @# @;
-
-
- 1.8
- date 93.04.04.23.31.06; author death; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 93.01.09.21.07.40; author death; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 93.01.01.11.51.45; author death; state Exp;
- branches ;
- next 1.5;
-
- 1.5
- date 92.12.31.15.35.30; author death; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 92.12.05.23.07.44; author death; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 92.12.03.18.02.17; author death; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 92.11.27.19.38.23; author death; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 92.11.08.09.29.06; author death; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.8
- log
- @Sun Apr 4 23:31:05 PDT 1993
- @
- text
- @%BEGIN Regions
-
- %%%%%%%%%%%%%
- % Note:
- % regionBounds and regionPath is defined in the common file
- % regionInfo is top, left, bot, right coords of bounding rect, followed by the number
- % of shapes. Each spape is the number of vertices, followed by that many x,y pairs
- % that represent the corners of the shape.
- %%%%%%%%%%%%%
-
- %%%%%%%%%%%%%
- % Name: frameRgn [0080]
- % Syntax: regionInfo frameRgn -
- % About: Set up bounds. If pen sizes > 0 draw two paths. The outer goes from passed
- % vertex to passed vertex, drawing the outer edge. The second is inset by the
- % sizes of penWidth and penHeight. Fill between these to get a frame of right size.
- %%%%%%%%%%%%%
- /frameRgn
- {
- gsave
- penPattern usePattern
- /tempRight exch def
- /tempBottom exch def
- /tempLeft exch def
- /tempTop exch def
- /numShapes exch def
- numShapes 0 eq
- {
- %
- % No shapes, frame the bounding rect. (do this by building a
- % 'fake' region shape for following routines to consume
- %
- tempLeft tempTop tempRight tempTop
- tempRight tempBottom tempLeft tempBottom
- 4
- /numShapes 1 def
- }
- {
- tempTop tempLeft tempBottom tempRight regionBounds
- clip
- }
- ifelse
-
- penWidth 0 le
- penHeight 0 le
- or
- {
- %
- % Consume & discard coordinates, using the passed counts for the repeat
- %
- numShapes
- {
- { pop pop }
- repeat
- }
- repeat
- }
- {
- %
- % For each of the shapes, read in verticees and draw lines between
- % then, make a second pass over points, drawing inner path
- %
- newpath
- numShapes
- {
- /numCoords exch 2 mul def
- /ptArray numCoords array def
- /firsty exch def
- /firstx exch def
- %
- % Form the outer edge of shape, storing points in array
- %
- firstx firsty moveto
- 0 2 numCoords 3 sub % 3 is for: zero origin, and skipped first coords
- {
- /arrayIndex exch def
- /y1 exch def
- /x1 exch def
- ptArray arrayIndex x1 put
- ptArray arrayIndex 1 add y1 put
- x1 y1 lineto
- }
- for
- closepath
- %
- % Compute inner edge. While inset by pen size, we must put vertices
- % in non straightforward position. lastx was the x coord of last vertex
- % we saw. thisx is the x of the current vertex. pendx is the x coordinate
- % that is proposed for the vertex to be drawn that cooresponds to the lastx
- % This is because we can not definitely figure out where point N's inset
- % coords are without knowing where point N+1 is. Do a couple examples.
- %
- /pendx firstx penWidth add def
- /pendy firsty penHeight sub def
- /lastx ptArray 0 get def
- /lasty ptArray 1 get def
- pendx pendy moveto
- 2 4 numCoords 5 sub
- {
- /arrayIndex exch def
-
- /thisx ptArray arrayIndex get def
- /thisy ptArray arrayIndex 1 add get def
- %
- % If thisy - lasty > 0, pendx = lastx + penWidth
- %
- /pendx lastx penWidth
- thisy lasty sub 0 gt {add} {sub} ifelse
- def
- pendx pendy lineto
- /lastx thisx def
- /lasty thisy def
-
- /thisx ptArray arrayIndex 2 add get def
- /thisy ptArray arrayIndex 3 add get def
- /pendy lasty penHeight
- thisx lastx sub 0 gt {sub} {add } ifelse
- def
- pendx pendy lineto
- /lasty thisy def
- /lastx thisx def
-
- }
- for
- firstx penWidth add pendy lineto
- closepath
- }
- repeat
- eofill
- }
- ifelse
- grestore
- }
- def
-
- %%%%%%%%%%%%%
- % Name: paintRgn [0081]
- % Syntax: regionInfo paintRgn -
- % About: Fill the passed region with the pen pattern (use eofill because there
- % may be shapes within shapes all drawn in same direction). Note:
- % If there are no shapes, we just fill the 'bounding' rect.
- %%%%%%%%%%%%%
- /paintRgn
- {
- gsave
- penPattern usePattern
- regionBounds
- /numShapes exch def
- numShapes 0 eq
- { fill }
- {
- clip
- numShapes regionPath
- eofill
- }
- ifelse
- grestore
- }
- def
-
- %%%%%%%%%%%%%
- % Name: eraseRgn [0082]
- % Syntax: regionInfo eraseRgn -
- % About: Fill the passed region with the background pattern (use eofill because there
- % may be shapes within shapes all drawn in same direction). Note:
- % If there are no shapes, we just fill the 'bounding' rect.
- %%%%%%%%%%%%%
- /eraseRgn
- {
- gsave
- backPattern usePattern
- regionBounds
- /numShapes exch def
- numShapes 0 eq
- { fill }
- {
- clip
- numShapes regionPath
- eofill
- }
- ifelse
- grestore
- }
- def
-
-
- %%%%%%%%%%%%%
- % Name: invertRgn [0083]
- % Syntax: regionInfo invertRgn -
- % About: Consume the region data. No inversion because we can't easily.
- %%%%%%%%%%%%%
- /invertRgn
- {
- gsave
- regionBounds
- regionPath
- grestore
- } def
-
- %%%%%%%%%%%%%
- % Name: fillRgn [0084]
- % Syntax: regionInfo fillRgn -
- % About: Fill the passed region with the fill pattern (use eofill because there
- % may be shapes within shapes all drawn in same direction). Note:
- % If there are no shapes, we just fill the 'bounding' rect.
- %%%%%%%%%%%%%
- /fillRgn
- {
- gsave
- fillPattern usePattern
- regionBounds
- /numShapes exch def
- numShapes 0 eq
- { fill }
- {
- clip
- numShapes regionPath
- eofill
- }
- ifelse
- grestore
- }
- def
-
- %%%%%%%%%%%%%
- % Name: frameSameRgn [0088]
- % Syntax: - frameSameRgn -
- % About: Apple doesn't implement this, so nor do I
- %%%%%%%%%%%%%
- /frameSameRgn
- { }
- def
-
- %%%%%%%%%%%%%
- % Name: paintSameRgn [0089]
- % Syntax: - paintSameRgn -
- % About: Apple doesn't implement this, so nor do I
- %%%%%%%%%%%%%
- /paintSameRgn
- { }
- def
-
- %%%%%%%%%%%%%
- % Name: eraseSameRgn [008A]
- % Syntax: - eraseSameRgn -
- % About: Apple doesn't implement this, so nor do I
- %%%%%%%%%%%%%
- /eraseSameRgn
- { }
- def
-
- %%%%%%%%%%%%%
- % Name: invertSameRgn [008B]
- % Syntax: - invertSameRgn -
- % About: Apple doesn't implement this, so nor do I
- %%%%%%%%%%%%%
- /invertSameRgn
- { }
- def
-
- %%%%%%%%%%%%%
- % Name: fillSameRgn [008C]
- % Syntax: - fillSameRgn -
- % About: Apple doesn't implement this, so nor do I
- %%%%%%%%%%%%%
- /fillSameRgn
- { }
- def
-
- %END Regions
- @
-
-
- 1.7
- log
- @Sat Jan 9 21:07:40 PST 1993
- @
- text
- @@
-
-
- 1.6
- log
- @Fri Jan 1 11:51:45 PST 1993
- @
- text
- @@
-
-
- 1.5
- log
- @Thu Dec 31 15:35:30 PST 1992
- @
- text
- @@
-
-
- 1.4
- log
- @Sat Dec 5 23:07:44 PST 1992
- @
- text
- @d3 7
- a9 3
- %
- % regionPath is defined in the common file
- %
- d11 7
- a17 21
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0080
- % Name: frameRgn
- % Syntax: - frameRgn -
- % Description:
- % Takes a region. After setting up the bounds around the region, we check on the
- % penwidth. If it's zero, then we draw nothing and just consume all the vertices
- % and their data. Otherwise, for each shape, we draw lines as defined by the points
- % that were written out.
- % Bugs:
- % This used PICTline to frame the region, which is inaccurte, as the framing of
- % a region does not hang down and to the right.
- % A smarter way would be to keep track of whether we're drawing a left, right top
- % or bottom side, and probably compensate appropriately with PICTline. We can do
- % this because the app always writes out the lines of a shape in a specific order, so it
- % should be possible to keep track of what kinda line is about to be drawn.
- % (it writes out the left coordinate of the first horozontal line, then the right, and
- % then moves to rightline. if it's up, then we want to extend to the right, if it's down
- % then we want to extend to the left, since tis keeps the extending inside the shape.
- % And so on. Note that that will probably fail for shapes contained within others??
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d27 1
- a27 1
- numShapes 0 gt
- a28 6
- tempTop tempLeft tempBottom tempRight regionBounds
- clip
- }
- {
- tempTop tempLeft tempBottom tempRight regionBounds
- clip
- d30 2
- a31 2
- % Construct a fake region so the following code will just parse this as if
- % it were notmal
- d38 4
- d43 4
- a46 3
- penWidth 0 gt
- penHeight 0 gt
- and
- d49 1
- a49 2
- % Loop for each of the shapes, read in verticees and draw lines between.
- % be sure to draw the line between last and first point!
- d51 12
- d70 3
- d74 1
- a74 1
- 0 2 numCoords 3 sub % convert to 0 origin, and don't store firstx or y
- d77 5
- a81 5
- /y2 exch def
- /x2 exch def
- ptArray arrayIndex x2 put
- ptArray arrayIndex 1 add y2 put
- x2 y2 lineto
- d85 8
- a92 1
-
- d104 3
- a129 1
-
- a130 11
- {
- %
- % Consume the data, as the pen widht or height are 0.
- %
- numShapes
- {
- { pop pop }
- repeat % using the count of points stored on the stack
- }
- repeat
- }
- d136 7
- a142 11
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0081
- % Name: paintRgn
- % Syntax: - paintRgn -
- % Description:
- % Takes a region, builds a path, and then paints it with the paint pattern
- % Use eofill because shapes inside others won't have opposite directions for
- % their being drawn, necessarily. Note that if there are 0 shapes, we simply
- % fill the bounding rect.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d161 7
- a167 11
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0082
- % Name: eraseRgn
- % Syntax: - eraseRgn -
- % Description:
- % Takes a region, builds a path, and then erases it with the background pattern
- % Use eofill because shapes inside others won't have opposite directions for
- % their being drawn, necessarily. Note that if there are 0 shapes, we simply
- % fill the bounding rect.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d187 5
- a191 9
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0083
- % Name: invertRgn
- % Syntax: - invertRgn -
- % Description:
- % Takes a Rgngon, builds a path, and then inverts it. I haven't found
- % any draw apps that actually use this so I can see what it actually does,
- % so, I have little qualms about not even trying to implement it.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d200 7
- a206 11
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0084
- % Name: fillRgn
- % Syntax: - fillRgn -
- % Description:
- % Takes a region, builds a path, and then filles it with the fill pattern
- % Use eofill because shapes inside others won't have opposite directions for
- % their being drawn, necessarily. Note that if there are 0 shapes, we simply
- % fill the bounding rect.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d225 2
- a226 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0088
- % Name: frameSameRgn
- d228 2
- a229 3
- % Description:
- % This is not presently implemented by Apple, and thus it also does nothing here
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d234 2
- a235 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0089
- % Name: paintSameRgn
- d237 2
- a238 3
- % Description:
- % This is not presently implemented by Apple, and thus it also does nothing here
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d243 2
- a244 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 008A
- % Name: eraseSameRgn
- d246 2
- a247 3
- % Description:
- % This is not presently implemented by Apple, and thus it also does nothing here
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d252 2
- a253 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 008B
- % Name: invertSameRgn
- d255 2
- a256 3
- % Description:
- % This is not presently implemented by Apple, and thus it also does nothing here
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d261 2
- a262 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 008C
- % Name: fillSameRgn
- d264 2
- a265 3
- % Description:
- % This is not presently implemented by Apple, and thus it also does nothing here
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- @
-
-
- 1.3
- log
- @Thu Dec 3 18:02:16 PST 1992
- @
- text
- @d32 4
- a35 1
- regionBounds
- d37 18
- a54 1
- clip
- d63 1
- d66 2
- a67 1
- /numPoints exch def
- d70 2
- a71 3
- /x1 firstx def
- /y1 firsty def
- numPoints 1 sub
- d73 1
- d76 3
- a78 3
- x1 y1 x2 y2 PICTline
- /y1 y2 def
- /x1 x2 def
- d80 34
- a113 2
- repeat
- x1 y1 firstx firsty PICTline
- d116 2
- @
-
-
- 1.2
- log
- @Fri Nov 27 19:38:22 PST 1992
- @
- text
- @d12 4
- a15 1
- % Takes a region, builds a path, and then strokes it.
- d17 10
- a26 4
- % At the moment, regionPath ignores the region data. But, this
- % goes further and doesn't even use the penwidth or height when
- %%%%% Note the bug that the mac doesn't deal with framing things in this way,.
- % framwing whatever portion of the region that we frame...
- d33 1
- d35 3
- a37 2
- /numShapes exch def
- numShapes
- d39 5
- a43 6
- /numPoints exch def
- /firsty exch def
- /firstx exch def
- /x1 firstx def
- /y1 firsty def
- numPoints 1 sub
- d45 15
- a59 5
- /y2 exch def
- /x2 exch def
- x1 y1 x2 y2 PICTline
- /y1 y2 def
- /x1 x2 def
- a61 2
- x1 y1 firstx firsty PICTline
- closepath
- d63 12
- a74 1
- repeat
- d85 4
- a88 1
- % Takes a region, builds a path, and then erases it with the paint pattern
- d95 9
- a103 3
- clip
- regionPath
- fill
- d115 3
- d124 9
- a132 3
- clip
- regionPath
- fill
- d161 4
- a164 1
- % Takes a Rgngon, builds a path, and then fills it with the fill pattern
- d171 9
- a179 3
- clip
- regionPath
- fill
- @
-
-
- 1.1
- log
- @Sun Nov 8 09:29:06 PST 1992
- @
- text
- @d16 1
- d23 23
- a45 2
- regionPath
- stroke
- d62 2
- d82 2
- d103 1
- d120 2
- @
-